
<%@ page import="teste.Pessoa" %>
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="layout" content="kickstart" />
	<g:set var="entityName" value="${message(code: 'pessoa.label', default: 'Pessoa')}" />
	<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>

<body>

<div class="row">

  <div class="span3">
     <g:set var="selectedId" value="0" />
     <g:set var="activeMenuItem" value="mni_List" />
     <g:render template="menu"/>
  </div>
  
  <div class="span9">
			<section id="list-pessoa" class="first">
			
				<table class="table table-bordered" ng-controller="GridCtrl">
					<thead>
					
						<tr>
						<th>(*)</th>
						
							<g:sortableColumn property="nome" title="${message(code: 'pessoa.nome.label', default: 'Nome')}" />
							<g:sortableColumn property="depto" title="${message(code: 'pessoa.depto.label', default: 'Depto')}" />						
							<g:sortableColumn property="peso" title="${message(code: 'pessoa.peso.label', default: 'Peso')}" />
						
						</tr>
					</thead>
					<tbody>
					
					<g:each in="${pessoaInstanceList}" status="i" var="pessoaInstance">
					    
						<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
						<td>
						  <input type="radio" ng-model="selectedId" value="${pessoaInstance.id}" ng-click="onGridItemSelected(${pessoaInstance.id})">
						</td>
						
							<td><g:link action="show" id="${pessoaInstance.id}">${fieldValue(bean: pessoaInstance, field: "nome")}</g:link></td>

							<td>${fieldValue(bean: pessoaInstance, field: "depto")}</td>
						
							<td>${fieldValue(bean: pessoaInstance, field: "peso")}</td>
						
						</tr>
					</g:each>
					</tbody>
				</table>
				<div class="pagination">
					<bs:paginate total="${pessoaInstanceTotal}" />
				</div>
				
				<hr/>
				
				<table class="table table-striped table-bordered" ng-controller="GridCtrl" ng-init='loadObjects("${createLink(uri: '/pessoa/listJSON')}")'>
					<thead>
					
						<tr>
						<th>(*)</th>
						
							<g:sortableColumn property="nome"  title="${message(code: 'pessoa.nome.label', default: 'Nome')}" />
							<g:sortableColumn property="depto" title="${message(code: 'pessoa.depto.label', default: 'Depto')}" />						
							<g:sortableColumn property="peso"  title="${message(code: 'pessoa.peso.label', default: 'Peso')}" />
						
						</tr>
						
					</thead>
					<tbody>

                        <tr ng-repeat="pessoa in objects">
							<td>
							  <input name="selecionado" type="radio" ng-model="selectedId" ng-click="onGridItemSelected(pessoa.id)">
							</td>							
							<td><a ng-href="${createLink(uri: '/pessoa/show')}/{{pessoa.id}}">{{pessoa.nome}}</a></td>	
							<td>{{pessoa.depto}}</td>							
							<td>{{pessoa.peso}}</td>						
						</tr>
					
					</tbody>
				</table>
				
			</section>
  </div>
</div>


<div class="modal hide fade" id="myModal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">×</button>
    <h3>Modal header</h3>
  </div>
  <div class="modal-body">
    <g:render template="form" />
  </div>
  <div class="modal-footer">
    <a href="#" class="btn" data-dismiss="modal">Close</a>
    <a href="#" class="btn btn-primary">Save changes</a>
  </div>
</div>

</body>

</html>
